#include "smartlinkservenfromjava.h"

SmartLinkServenFromJava::SmartLinkServenFromJava(QObject *parent) : QObject(parent)
{
    qDebug()<<"注册成败："<< registerNativeMthode ();
}

QString SmartLinkServenFromJava::getSSID()
{
    QAndroidJniObject jSSID=QAndroidJniObject::callStaticObjectMethod("an/qt/hello/SmartLinkForQt","getSSID","()Ljava/lang/String;");//注意<jstring>  jstring 匹配，调用静态方法
    return jSSID.toString ();
}

bool SmartLinkServenFromJava::startLink (QString ssid, QString password){
    jstring jssid=QAndroidJniObject::fromString (ssid).object<jstring>();
    jstring jpassword=QAndroidJniObject::fromString (password).object<jstring>();
    jboolean jsucessful=QAndroidJniObject::callStaticMethod<jboolean>("an/qt/hello/SmartLinkForQt","startSmartLink","(Ljava/lang/String;Ljava/lang/String;)Z",jssid,jpassword);
//    jboolean successful=jsucessful.object<jboolean>;
//    qDebug()<<"连接开启："<<successful;
    return true;
}
